# -*- coding: utf-8 -*-

# pip install networkx
import networkx as nx


def test_networkx():
    G = nx.Graph()
    G.add_edge("A", "B", weight=4)
    G.add_edge("B", "D", weight=2)
    G.add_edge("A", "C", weight=3)
    G.add_edge("C", "D", weight=4)
    path = nx.shortest_path(G, "A", "D", weight="weight")
    print(path)
    pass


if __name__ == '__main__':
    test_networkx()
    pass
